﻿var peopleResultsUrl = insiteRootUrl + '/search/Pages/results.aspx?k=';
var emptyText = 'Search this site, people, and all sites...';
var minSearchChars = 3;

$(function () {
    $('#pscinput').focus(
		function () {
		    if (this.value == emptyText) {
		        this.value = '';

		        $(this).removeClass('searchEmpty');
		    }
		}
	).blur(
		function () {
		    if (this.value == '') {
		        this.value = emptyText;

		        $(this).addClass('searchEmpty');
		    }
		}
	).keyup(
		function (event) {
		    if (event.keyCode == 13)
		        GoToPeopleSearch();
		});
});

function GoToPeopleSearch() {
    var inval = $("#pscinput").val();

    if (inval.length > 0 && inval != emptyText) {
        document.location = peopleResultsUrl + encodeURI(inval);
    }
}


